<template>
    <div v-loading="loading" class="container view-form">
        <view-form v-if="ready" :formName="formNames" :pageType="pageType" :values="values"></view-form>
        <div class="button-region">
            <el-button size="small" class="button form-button cancel" @click="$router.back()">返回</el-button>
        </div>
    </div>
</template>
<script>
import { ViewForm } from 'party_fe_component/src/components/dynamicForm';
import dataFormatter from '../../common/dataFormatter';
export default {
    props: {

    },
    data () {
        return {
            formNames: '',
            loading: false,
            ready: false,
            values: {}
        }
    },
    mounted () {
        this.fetchData();
    },
    methods: {
        formatViewData: function (formName, data) {
            const formatter = dataFormatter['view'][formName] || dataFormatter['view']['common'];
            return formatter(data);
        }
    },
    computed: {
        id: function () {
            return this.$route.query.id;
        },
        parentId: function () {
            return this.$route.query.parentId;
        },
        parentName: function () {
            return this.$route.query.parentName;
        },
        formName: function () {
            return this.$route.query.formName;
        },
        pageType: function () {
            return this.$route.query.pageType;
        }
    },
    components: { ViewForm }
}
</script>
<style scoped lang="scss">
    @import '@/css/baseForm.scss';
</style>
